const { View , Text , Button} = require("@tarojs/components");
import './AwaitPayment.less'
import http from '../../../../utils/http'
import Taro,{useReady} from '@tarojs/taro'
import React, { useState} from 'react'


const cancel=(b)=>{
    Taro.navigateTo({
        url:'/pages/HXM/CancelRefundDetails/CancelRefundDetails?id='+b,
    })
}
const go=(b)=>{
console.log(b)
}

function AwaitPayment () {

    const [index,setIndex]=useState('')
    const [sum,setSum]=useState()
    const [id,setId]=useState('')
    const [arr,setArr]=useState({})

    useReady(() => {
		setId(Taro.getCurrentInstance().router.params.id)
        http({   //获取我的体检详细
            url:"/getaccomplishphysical",
            data:{
                order_orderId:Taro.getCurrentInstance().router.params.id
            },
            header:{
                'content-type': 'application/json' 
            },
        }).then((res)=>{
            setArr(res[0])
            setSum(res[0].contentPrice+res[0].phy_salePrice)
        })
      })

    return(
        <View>
		<View className="body">
			<View class="view1" >
				<View class="view1-1">
					<Text>{arr.user_name} {arr.user_tel}</Text>
				</View>
				<View class="view1-2">
					<View>
						体检机构: <text> {arr.org_Name}</text>
					</View>
					<View>
						体检时间: <text> {arr.order_date}</text>
					</View>
					<View>
						体检单号: <text> {arr.productId}</text>
					</View>
				</View>
			</View>
			<View class="view2">
				<View class="view2-1">
					<Text>订单编号：{arr.order_orderId}</Text>
				</View>
				<View class="view2-2">
					<View>
						<Text>{arr.order_orderId}</Text>
						<Text>￥{arr.contentPrice}</Text>
					</View>
					<View>
						<Text>{arr.phy_projectName}</Text>
						<Text>￥{arr.phy_salePrice}</Text>
					</View>
					<View>
						<Text style="color:red">合计</Text>
						<Text style="color:red">￥{sum}</Text>
					</View>
				</View>
			</View>
		</View>
		<view class="view4">
			<button type="primary" plain="true" onClick={cancel.bind(this,id)}>取消订单</button>
			<button type="primary" plain="true" onClick={go.bind(this,id)}>去支付</button>
		</view>
	</View>
    )
}
export default AwaitPayment